<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right">市场价</label>
  <div class="col-12 col-sm-9">
  	<input class="form-control" type="text" name="parameter[inctype_marketprice]" value="{$parameter[marketprice]}">
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right">本店价</label>
  <div class="col-12 col-sm-9">
  	<input class="form-control" type="text" name="parameter[inctype_price]" value="{$parameter[price]}">
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right"><input type="checkbox" id="promotestatus" value="1"><span>促销价</span></label>
  <input type="hidden" id="promotestatusval" name="parameter_default[promotestatus]" value="{$parameter_default[promotestatus]}">
  <div class="col-12 col-sm-9">
      <input id="promotetitle" class="form-control" type="text" name="parameter[inctype_promotetitle]" value="{$parameter[promotetitle]}" placeholder="请输入促销标题" disabled="disabled" style="width:30%; display:inline-block;">
      <select id="promotetype" class="form-control" name="parameter[inctype_promotetype]" disabled="disabled" style="width:20%; display:inline-block;">
         <option value="0">减价优惠</option>
         <option value="1">折扣优惠</option>
      </select>
      <select id="hdstatus" class="form-control" name="parameter_default[hdstatus]" disabled="disabled" style="width:20%; display:inline-block;">
         <option value="0">参与订单活动同时折扣</option>
     	 <option value="1">不与订单活动同时享受</option>
      </select>
      <input id="promoteprice" class="form-control" type="text" name="parameter[inctype_promoteprice]" value="{$parameter[promoteprice]}" placeholder="请输入优惠价格" disabled="disabled" style="width:20%; display:inline-block;">
      <div style="background: #f3f3f3; border: 1px solid #ddd; padding: 10px; color:#0066b5; border-radius: 5px; margin-top:10px;">
                                    <p class="help-block">
      减价优惠：请输入减价金额 单位：元<br />
      折扣优惠：请输入0.1~10之间的数字,值为空代表不设置折扣
      </p>
      </div>
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right">有效期</label>
  <div class="col-12 col-sm-9">
  	  <input id="promotetime" class="form-control" type="date" name="parameter_default[datetype_promotetime]" disabled="disabled" value="{$parameter_default[datetype_promotetime]}">
      <p class="help-block">促销活动离结束的有效时间</p>
	  <script>
	  $("#promotestatus").click(function(){
		  if(this.checked != ""){
			$('#promotestatusval').val(1);
			$('#promotetitle').prop("disabled",false); 
			$('#promoteprice').prop("disabled",false); 
			$('#promotetype').prop("disabled",false); 
			$('#hdstatus').prop("disabled",false); 
			$('#promotetime').prop("disabled",false); 
		  }else{
			$('#promotestatusval').val(0);
			$('#promotetitle').prop("disabled",true); 
			$('#promoteprice').prop("disabled",true); 
			$('#promotetype').prop("disabled",true); 
			$('#hdstatus').prop("disabled",true); 
			$('#promotetime').prop("disabled",true); 
		  }
	  });
	  // 是否促销
	  var promotestatusval = "($parameter_default[promotestatus])";
	  if(Number(promotestatusval) == 1){
		$('#promotestatus').prop("checked",true); 
		$('#promotetitle').prop("disabled",false); 
		$('#promoteprice').prop("disabled",false); 
		$('#promotetype').prop("disabled",false); 
		$('#hdstatus').prop("disabled",false); 
		$('#promotetime').prop("disabled",false); 
	  }
	  // 促销类型
	  var promotetype = "($parameter[promotetype])";
	  if(Number(promotetype) == 1){
		$("#promotetype").find("option[value='1']").prop("selected", true);
	  }
	  // 活动状态
	  var hdstatus = "($parameter_default[hdstatus])";
	  if(Number(hdstatus) == 1){
		$("#hdstatus").find("option[value='1']").prop("selected", true);
	  }
	  </script>
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right">赠送积分</label>
  <div class="col-12 col-sm-9">
      <input class="form-control" id="giveintegral" type="text" name="parameter[inctype_giveintegral]" value="{$parameter[giveintegral]}">
      <p class="help-block">购买该商品时赠送消费积分数,-1表示按商品价格赠送</p>
      <script>
      var giveintegral = "{$parameter[giveintegral]}";
      if(giveintegral == ''){
          $('#giveintegral').val(-1);
      }
      </script>
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right"><input type="checkbox" id="integraldkstatus" value="1"><span>积分抵扣</span></label>
  <input type="hidden" id="integraldkstatusval" name="parameter_default[integraldkstatus]" value="{$parameter_default[integraldkstatus]}">
  <div class="col-12 col-sm-9">
      <input id="integraldkprice" class="form-control" type="text" name="parameter[inctype_integraldkprice]" value="{$parameter[integraldkprice]}" disabled="disabled">
      <p class="help-block">(此处需填写金额)购买该商品时最多可以使用积分的金额</p>
      <script>
      $("#integraldkstatus").click(function(){
          if(this.checked != ""){
            $('#integraldkstatusval').val(1);
            $('#integraldkprice').prop("disabled",false); 
          }else{
            $('#integraldkstatusval').val(0);
            $('#integraldkprice').prop("disabled",true); 
          }
      });
      // 是否促销
      var integraldkstatusval = "($parameter_default[integraldkstatus])";
      if(Number(integraldkstatusval) == 1){
        $('#integraldkstatus').prop("checked",true); 
        $('#integraldkprice').prop("disabled",false);
      }
      </script>
  </div>
</div>
<div class="form-group row">
  <label class="col-12 col-sm-2 col-form-label text-right"><input type="checkbox" id="integralstatus" value="1"><span>积分兑换</span></label>
  <input type="hidden" id="integralstatusval" name="parameter_default[integralstatus]" value="{$parameter_default[integralstatus]}">
  <div class="col-12 col-sm-9">
      消耗：<input id="integralprice" class="form-control" type="text" name="parameter[inctype_integralprice]" value="{$parameter[integralprice]}" disabled="disabled" style="width:30%; display:inline-block;"> 积分
      +
      金额：<input id="exchangeprice" class="form-control" type="text" name="parameter[inctype_exchangeprice]" value="{$parameter[exchangeprice]}" disabled="disabled" style="width:30%; display:inline-block;"> 元
      <p class="help-block">可任意组合，可以单独积分兑换，或者积分+现金形式兑换(积分必须大于0)</p>
      <script>
      $("#integralstatus").click(function(){
          if(this.checked != ""){
            $('#integralstatusval').val(1);
            $('#integralprice').prop("disabled",false); 
            $('#exchangeprice').prop("disabled",false); 
          }else{
            $('#integralstatusval').val(0);
            $('#integralprice').prop("disabled",true); 
            $('#exchangeprice').prop("disabled",true); 
          }
      });
      // 是否促销
      var integralstatusval = "($parameter_default[integralstatus])";
      if(Number(integralstatusval) == 1){
        $('#integralstatus').prop("checked",true); 
        $('#integralprice').prop("disabled",false);
        $('#exchangeprice').prop("disabled",false);
      }
      </script>
  </div>
</div>
<div class="form-group row">
    <label class="col-12 col-sm-2 col-form-label text-right">相册</label>
    <div class="col-12 col-sm-9">
        <ul id="photos" class="pic-list list-unstyled form-inline" style="margin-bottom:0;">
        <script>var jsonvar = '{$parameter_default[more]}';
               var data = JSON.parse(jsonvar);
               var photos=data.photos;
               var html='';
               for(var i=0;i<photos.length;i++)
                {
                    html += '<li id="saved-image'+i+'"><input id="photo-'+i+'" type="hidden" name="photo_urls[]" value="/'+photos[i].url+'">';
                     html += '   <input class="form-control" id="photo-'+i+'-name" type="text" name="photo_names[]" value="'+photos[i].name+'" style="width: 200px;" title="图片名称">';
                      html += '  <img id="photo-'+i+'-preview" src="/upload/'+photos[i].url+'" style="height:36px;width: 36px;" onclick="parent.imagePreviewDialog(this.src);">';
                      html += '  <a href="javascript:thimgi('+i+')">替换</a><a href="javascript:delimgi('+i+');">移除</a>';
                html += '</li>';
                }
                document.write(html);
                function thimgi(i)
                {
                    uploadOneImage("图片上传","#photo-"+i);
                }
                function delimgi(i)
                {
                    $("#saved-image"+i).remove();
                }
        </script>
                    
        </ul>
        <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
           class="btn btn-success">选择图片</a>
    </div>
</div>